package createdFurnituries;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class LogSystem implements Runnable {
	Thread t;
	FileOutputStream fileOut;
	ObjectOutputStream out;
	String fileName = "Rooms.ll";
	public LogSystem() {
		t = new Thread(this);
		t.start();
	}
	public void run() {
		System.out.println("Start Serialization");
		try {
			fileOut = new FileOutputStream(fileName);
			out = new ObjectOutputStream(fileOut);
			out.writeObject(RoomList.rooms);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			if(fileOut !=null) {
				try {
					fileOut.close();
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
		}
	}
}
